<?php
namespace think;

use think\Controller;

class InitController extends Controller {
    public function __construct() {
        date_default_timezone_set('Asia/Shanghai');

        parent::__construct();
        $this->_initialize();
    }

    //检查登录状态
    public function _initialize() {
        //判断用户是否已经登录
        if (!session('?user_id')) {
            $this->success('登录失效，请重新登录', '/index/login');
        }
    }
}